<template>
    <div class="comb">
        <h2>组件B</h2>
        <p>{{msg}}</p>
        <!-- <button @click="bindSonToParent">子传父</button> -->
        <button @click="$emit('bindInfo',info)">子传父</button>
    </div>
</template>

<script>
    export default {
        props:['msg'],
        data() {
            return {
                info:'这是子组件数据'
            }
        },
        methods:{
            bindSonToParent(){
                this.$emit('bindInfo',this.info)
            }
        }
    }
</script>

<style lang="css" scoped>
.comb{
    width: 300px;
    height: 400px;
    background-color: rgb(88, 174, 62);
}
</style>